package response

import (
	xhttp "github.com/18767156402/x/http"
	"net/http"
)

func Response(r *http.Request, w http.ResponseWriter, resp any, err error) {
	if err != nil {
		// code-data 响应格式
		xhttp.JsonBaseResponseCtx(r.Context(), w, err)
	} else {
		// code-data 响应格式
		xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
	}
}
